package ltd.dujiabao.inventoryservice.controller;

import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import ltd.dujiabao.inventoryservice.service.InventoryTccService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ltd.dujiabao.common.dto.DeductStockDto;


/**
 * @author Bowie Du
 * @date 2025/7/22 20:08
 */

@Slf4j
@RestController
public class InventoryController {
    @Autowired
    private InventoryTccService inventoryService;

    @PostMapping("/deductStock")
    public void deductStock(@RequestBody @Valid DeductStockDto dto) {
        inventoryService.deductStock(dto.getProductId(), dto.getQuantity());
    }
}
